<template>
  <div>
    <el-button @click="setStore">修改store里面的数据</el-button>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  name: "Demo_10",
  data() {
    return {};
  },
  computed: {
    // 使用辅助函数批量引入
    ...mapGetters(["GET_MSG"]),
  },
  mounted() {},
  created() {
    console.log("vuex里面的数据", this.$store.state);
    console.log("通过 mapGetters 扩展运算符获取值", this.GET_MSG);
  },
  methods: {
    setStore() {
      this.$store.commit("SET_MSG", "修改后的数据");
    },
  },
};
</script>
